home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1994 by Olaf `Olsen' Barthel
- ** Freely distributable.
- */
-
- #include "gtlayout_global.h"
-
- VOID LIBENT
- LT_DeleteHandle(REG(a0) LayoutHandle *Handle)
- {
- if(Handle)
- {
- UnlockPubScreen(NULL,Handle -> PubScreen);
- #ifdef DO_CLONING
- if(Handle -> CloneExtra)
- {
- if(Handle -> CloneExtra -> Screen)
- ScreenToBack(Handle -> CloneExtra -> Screen);
- }
- #endif
- if(Handle -> List)
- {
- struct Gadget *Gadget;
- ObjectNode *Node;
-
- if(Handle -> Window)
- RemoveGList(Handle -> Window,Handle -> List,(UWORD)-1);
-
- Gadget = Handle -> List;
-
- if(Handle -> ExitFlush)
- {
- while(Gadget)
- {
- if(GETOBJECT(Gadget,Node))
- {
- LTP_PutStorage(Node);
-
- LTP_DeleteObjectNode(Handle,Node);
- }
-
- Gadget = Gadget -> NextGadget;
- }
- }
- else
- {
- while(Gadget)
- {
- if(GETOBJECT(Gadget,Node))
- LTP_DeleteObjectNode(Handle,Node);
-
- Gadget = Gadget -> NextGadget;
- }
- }
-
- FreeGadgets(Handle -> List);
- }
-
- if(Handle -> Parent)
- LT_UnlockWindow(Handle -> Parent);
-
- if(Handle -> Window)
- {
- LT_DeleteWindowLock(Handle -> Window);
-
- if(Handle -> MsgPort && Handle -> Window -> UserPort)
- {
- struct IntuiMessage *intuiMsg;
- struct Node *next;
-
- Forbid();
-
- intuiMsg = (struct IntuiMessage *)Handle -> Window -> UserPort -> mp_MsgList . lh_Head;
-
- while(next = intuiMsg -> ExecMessage . mn_Node . ln_Succ)
- {
- if(intuiMsg -> IDCMPWindow == Handle -> Window)
- {
- Remove(intuiMsg);
-
- ReplyMsg(intuiMsg);
- }
-
- intuiMsg = (struct IntuiMessage *)next;
- }
-
- Handle -> Window -> UserPort = NULL;
-
- ModifyIDCMP(Handle -> Window,NULL);
-
- Permit();
- }
-
- ClearMenuStrip(Handle -> Window);
- CloseWindow(Handle -> Window);
- }
-
- DisposeObject(Handle -> AmigaGlyph);
- DisposeObject(Handle -> CheckGlyph);
-
- FreeScreenDrawInfo(Handle -> Screen,Handle -> DrawInfo);
-
- FreeVisualInfo(Handle -> VisualInfo);
-
- if(Handle -> RPort . Font && Handle -> CloseFont)
- CloseFont(Handle -> RPort . Font);
- #ifdef DO_CLONING
- if(Handle -> CloneExtra)
- {
- if(Handle -> CloneExtra -> Screen)
- CloseScreen(Handle -> CloneExtra -> Screen);
- }
- #endif
- if(Handle -> Pool)
- AsmDeletePool(Handle -> Pool,SysBase);
-
- FreeMem(Handle,sizeof(LayoutHandle));
- }
- }
-